<layout name="layout"/>
<ol class="breadcrumb">
    <li><a href="{:url('/')}">首页</a></li>
    <li class="active">借书管理</li>
</ol>
<div class="clearfix">
    <form action="" class="form-inline pull-left" method="get">
        <input type="search" class="form-control" placeholder="ISBN/书名/作者/出版社/姓名/手机" id="keyword" name="keyword" value="{$Think.get.keyword}">
        <button class="btn btn-default" type="submit">筛选</button>
    </form>
    <a href="{:url('lend/add')}" class="btn btn-primary pull-right">添加出借记录</a>
</div>
<hr>
<empty name="list">
    <p>暂时没有书籍</p>
    <else/>
    <div class="table-responsive">
        <table class="table table-bordered table-striped">
            <tr>
                <td>书籍</td>
                <td>用户</td>
                <td>出借时间</td>
                <td>应还时间</td>
                <td>实际归还</td>
                <td>备注</td>
                <td>操作</td>
            </tr>
            <volist name="list" id="item">
                <tr>
                    <td>{$item.book.title}/{$item.book.author}/{$item.book.publisher}/{$item.book.isbn}</td>
                    <td>{$item.user.realname}/{$item.user.phone}</td>
                    <td>{$item.lending_date}</td>
                    <td>{$item.should_return_date}</td>
                    <td>
                        <empty name="item.return_at">
                            未归还
                            <else/>
                            {$item.return_at|date='Y-m-d H:i:s',###}
                        </empty>
                    </td>
                    <td>{$item.remark}</td>
                    <td>
                        <a href="{:url('lend/update',['book_id'=>$item['book_id'],'user_id'=>$item['user_id']])}">编辑</a>
                        <empty name="item.return_at">
                            <a href="{:url('lend/return',['book_id'=>$item['book_id'],'user_id'=>$item['user_id']])}"
                               onclick="return confirm('确定操作吗?');">归还</a>
                        </empty>
                    </td>
                </tr>
            </volist>
        </table>
    </div>
    {$list->render()}
</empty>